package net.hn.hnms.biz.mine.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.hn.hnms.biz.mine.domain.DataStateConfig;
import net.hn.hnms.biz.mine.domain.vo.OptionVo;
import net.hn.hnms.biz.mine.service.DataStateService;
import net.hn.hnms.sys.common.core.domain.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Author: PanSX
 * Date: 2023/5/31 14:46
 */

@RestController
@RequestMapping("dataState")
@Api(value = "数据状态", tags = {"各系统数据状态"})
@RequiredArgsConstructor
public class DataStateController {
    private final DataStateService dataStateService;

    @GetMapping("getDataState")
    @ApiOperation("获取数据状态")
    public R<List<DataStateConfig>> getDataState(@RequestParam(value = "sysName", required = false) String sysName) {
        return R.ok(dataStateService.getStates(sysName));
    }

    @ApiOperation("子系统在线离线率")
    @GetMapping("getOnlineRate")
    public R<List<OptionVo>> getOnlineRate() {
        return R.ok(dataStateService.getOnlineRate());
    }

}
